#ifndef __DATASTORE__
#define __DATASTORE__

#include "object.h"

/*
  Loads the configuration data from given configuration file

  Here's the format:

  BUCKETNAME = libcurl-tests
  S3_END_POINT = s3-us-west-1.amazonaws.com
  ACCESS_KEY_ID = ....
  SECRET_ACCESS_KEY = ...

  Returns 0 on success, -1 on failure.
*/
int load_config (const char *filename);

/*
  Finds the object with the given name in the cloud bucket, and stores 
  it back to the disk in the cache with the same name. 

  Returns 0 on success, -1 on failure.
*/
int get_cloud_object (char *object_name, aeskey *k);

/*
  Takes the object with the given name in the cache, and writes it to the
  cloud storage.

  Returns 0 on success, -1 on failure.
*/
int put_cloud_object (char *object_name);

/*
  Returns the list of the objects which start with a given prefix, by
  putting them in the area specified by the caller. The max available
  bytes are also specified by the caller. 

  If the count of objects with the prefix is more than the what is 
  available with max_length bytes, return -ENOMEM.
  If everything goes good, returns number of elements in the list, for 
  any other error, return -1.
*/
int list_cloud_object (char *prefix, int max_length, void *list);

#endif /* __DATASTORE__ */
